#
#		/*********************************************
#		**					    **
#		**                  Makefile                **
#		**	             (user)		    **
#		**					    **
#		*********************************************/
#		/*********************************************
#		**					    **
#		** 	     Author Jean-Marc Adamo         **
#               **                12/31/97                  **
#               **           Copyright (C) 1997 JMA         **
#		*********************************************/

#

#
#
# Installation dir: should be set according to ARCH installation
ARCH_INSTALL = /home/adamo/ARCH-2-1.0.6p1-pthread/ARCH.v6.1.unix/ARCH

#
# MPI Installation: should be set according to installation
#
MPI_INSTALL = /home/adamo/mpich2-1.0.6p1-install

#
# commands
#
RM = \rm
CP = \cp
MKDIR = \mkdir


#
# This is the location of current application
APPLIC_DIR  = .

#
#
# store for objects
#
PROG_OBJ_DIR = $(APPLIC_DIR)/Prog_obj


#
#
# Include directories 
#
ARCH_INCL_PATH  = -I$(ARCH_INSTALL)/Include
MPI_INCL_PATH   = -I$(MPI_INSTALL)/include
OTHER_INCL_PATH = 
INCL_PATHS = $(ARCH_INCL_PATH)  $(MPI_INCL_PATH) \
             $(OTHER_INCL_PATH)

#
#
# Link lib directories: to be set according to installation 
#
ARCH_LIB_PATH   = -L$(ARCH_INSTALL)/Lib
CC_LIB_PATH     = 
THRD_LIB_PATH   = -L/usr/lib
MPI_LIB_PATH    = 
OTHER_LIB_PATH  = 
LIB_PATHS =  $(ARCH_LIB_PATH) $(CC_LIB_PATH) \
             $(THRD_LIB_PATH ) $(MPI_LIB_PATH) $(OTHER_LIB_PATH)

#
#
# Libraries
#
ARCH_LIB   = -larch
CC_LIB     = -lstdc++  -ldl
THRD_LIB   = -lpthread
MPI_LIB    = 
#-lm
LIBS = $(ARCH_LIB) $(CC_LIB) $(THRD_LIB) $(MPI_LIB)


#
# compiler & linker stuff
# linker is mpicc
# to be set according to installation
#

CC = g++
CC_LINKER = $(MPI_INSTALL)/bin/mpicc
CC_OPT = -O2
DBG_FLAGS =
#DBG_FLAGS = -g -p
OTHER_FLAGS = -Wno-non-template-friend
FLAGS = -DFAST -DFPCOPY $(DBG_FLAGS) $(OTHER_FLAGS) $(CC_OPT)

empty:

clean_PROG_OBJ:	empty
	- $(RM) -rf $(PROG_OBJ_DIR)

clean_exe:      empty
	- $(RM) -rf exe

clean:  empty
	- $(RM) -rf $(PROG_OBJ_DIR) exe trace

exe:    empty
	- $(RM) -rf $(PROG_OBJ_DIR) exe
	make cld

cld:    $(SRC) Makefile $(ARCH_INSTALL)/Include/arch.h
	$(CC) $(FLAGS) $(INCL_PATHS) -c $(SRC) -o $(APPLIC_DIR)/prog.o
	- if [ ! -d $(PROG_OBJ_DIR) ] ; then $(MKDIR) $(PROG_OBJ_DIR); fi
	- if [ $(PROG_OBJ_DIR) != "." ] ; then mv $(APPLIC_DIR)/prog.o $(PROG_OBJ_DIR)/.; fi
	$(CC_LINKER) $(FLAGS) -o exe $(PROG_OBJ_DIR)/prog.o $(LIB_PATHS) $(LIBS)

